//  this library.
import 'package:flutter/material.dart';
// import 'package:hktk_app/pages/subject/paper_detail_page.dart';
import 'package:hktk_app/util/event_bus_util.dart';

// import 'package:hktk_app/widget/home/recommend_item_widget.dart';

/// 推荐区试卷显示
class PaperItemWidget extends StatelessWidget {
  /// 标题
  final String title;

  /// 人数（观看/做过）
  final int num;

  /// 副标题，副的相关数据
  final String subtitle;

  /// 栏目id
  final String columnId;

  /// 免费标志，true：免费/购买，false：未购买
  final bool free;

  /// 试卷左边显示
  final String type;

  /// 试卷对应id
  final String paperId;

  /// 试卷记录id
  final String? recordId;

  /// 考试对应数据下标
  final int index;

  const PaperItemWidget({
    super.key,
    required this.title,
    required this.num,
    required this.subtitle,
    required this.columnId,
    required this.free,
    required this.type,
    required this.paperId,
    this.recordId,
    required this.index,
  });

  @override
  Widget build(BuildContext context) {
    // return RecommendItemWidget(
    //   title: title,
    //   num: num,
    //   subtitle: subtitle,
    //   type: type,
    //   showPaper: true,
    //   btnType: free,
    //   btnStr: free ? "做题" : "购买",
    //   onTapFun: _onTapFun,
    // );
    return Text("11111");
  }

  /// 点击方法
  void _onTapFun(BuildContext context, String type) {
    if (free) {
      // 跳转到试卷做题详情页面
      _jumpPaperDetail(context);
    } else {
      // 跳转到套餐页面进行购买
      _jumpPackageBuy(context);
    }
  }

  /// 跳转试卷详情方法
  void _jumpPaperDetail(BuildContext context) {
    // NavigatorUtil.push(
    //   context,
    //   PaperDetailPage(
    //     id: paperId,
    //     columnId: columnId,
    //     recordId: recordId,
    //     index: index,
    //   ),
    // );
  }

  /// 跳转套餐购买页面进行
  void _jumpPackageBuy(BuildContext context) {
    //发送通知
    eventBus.fire(EventColumnsBuy(columnId: columnId));
  }
}
